import { Unitl } from "../Unitl";
Unitl.PrintStartTime();

Unitl.PrintOpeationName("类的访问修饰符");
class Book{
    public author: string = "";
    public name:string = "";
    public sale?:number;
    public static StaticProp:boolean = false;
    public readonly ReadProp:number = 123456;

    private  _cantGet:number = 666; 
    protected childCanGet:string = "child can get";
    constructor(author:string,name:string){
        this.author = author;
        this.name = name;
    }
}

const booken = new Book("HarryPe","Walker");
booken.sale = 56;
booken.name = "HLvm";
console.log(booken.ReadProp);

class TcClass extends Book{
protected childCanGet: string = "asd";
}

/*
TS中，类中的静态属性，对象不能直接获取，通过类直接获取。
*/

Unitl.PrintOpeationName("类的存取器");

class OtherClass{
    private _password :string = '';
    get password():string{
        let password:string = this._password + "****";
        return password;
    }

    set password(pas:string){
        this.password = pas;
    }

};

const test = new OtherClass();
test.password = "abc";
console.log(test.password);